<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
    <%--展示logo--%>
    <a class="navbar-brand" href="${pageContext.request.contextPath}/f-index/index"><img src="${pageContext.request.contextPath}/images/logo.png" height="30" alt="惠农网"></a>
    <%--选项卡--%>
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav mr-auto">
            <li class="nav-item active">
                <a class="nav-link" href="${pageContext.request.contextPath}/f-index/index">首页 <span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">供应大厅</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">采购大厅</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">行情大厅</a>
            </li>
        </ul>
    </div>
    <%--右侧--%>
    <div class="my-2 my-lg-0">
        <c:if test="${userNow!=null}">
            <span>尊敬的用户：${userNow.euUserName}，您好！</span>
            <a href="javascript:post('${pageContext.request.contextPath}/f-product/to-addcar',localStorage.getItem('addcar'));" class="shopping">
                <svg class="bi bi-cart4" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                    <path fill-rule="evenodd" d="M0 2.5A.5.5 0 0 1 .5 2H2a.5.5 0 0 1 .485.379L2.89 4H14.5a.5.5 0 0 1 .485.621l-1.5 6A.5.5 0 0 1 13 11H4a.5.5 0 0 1-.485-.379L1.61 3H.5a.5.5 0 0 1-.5-.5zM3.14 5l.5 2H5V5H3.14zM6 5v2h2V5H6zm3 0v2h2V5H9zm3 0v2h1.36l.5-2H12zm1.11 3H12v2h.61l.5-2zM11 8H9v2h2V8zM8 8H6v2h2V8zM5 8H3.89l.5 2H5V8zm0 5a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0zm9-1a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0z"/>
                </svg>
                购物车
            </a>
            <a href="${pageContext.request.contextPath}/f-comment/index">留言</a>
        </c:if>
        <c:if test="${userNow==null}">
            <a href="${pageContext.request.contextPath}/f-login/to_login">登录</a>
            <a href="${pageContext.request.contextPath}/f-register/to_register">注册</a>
        </c:if>
    </div>
</nav>
<div class="row w-100" style="height: 10px;"></div>
<script>
    function post(URL, PARAMS) {
        var temp = document.createElement("form");
        temp.action = URL;
        temp.method = "post";
        temp.style.display = "none";
            var opt = document.createElement("textarea");
            opt.name = "list";
            opt.value = PARAMS;
            // alert(opt.name)
            temp.appendChild(opt);
        document.body.appendChild(temp);
        temp.submit();
        return temp;
    }
    // 调用方法

</script>